<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>人工交易-交易记录-交易完成</title>
<meta name="description" content="">
<meta name="keywords" content="">
<link href="${ctx}/css/iconfont/iconfont.css" rel="stylesheet">
<link href="${ctx}/css/reset.css" rel="stylesheet">
<link href="${ctx}/css/ArtificialTrading.css" rel="stylesheet">
<script src="${ctx}/js/jquery.js"></script>
<script src="${ctx}/js/distpicker.data.js"></script>
<script src="${ctx}/js/main.js"></script>
<!-- <script src="../../js/excel.js"></script> -->
</head>
<body>
<div class="artificial-content">
  <div class="main1">
    <div class="dealClose">
          <div class="clearfix">
              <div class="Part-One">
                  <form action="" style="font-size:0px">
                      <div class="clearfix producttype">
                          <p class="fl font2 l"> 产品类型：</p>
                          <div class="fl inbtn">
                             <input type="button" value="银承纸票" class="button">
                             <input type="button" value="银承电票" class="button">
                             <input type="button" value="商承纸票" class="button">
                          </div>
                         <div class="bill">
                              <p class="fl font2 l"> 交易类型：</p>
                              <div class="fl inbtn">
                                 <input type="button" value="询价买入" class="button">
                                 <input type="button" value="询价卖出" class="button">
                                 <input type="button" value="指定买入" class="button">
                                 <input type="button" value="指定卖出" class="button">
                                 <input type="button" value="报价买入" class="button">
                                 <input type="button" value="报价卖出" class="button">
                                 <input type="button" value="被指定买入" class="button">
                                 <input type="button" value="被指定卖出" class="button">
                              </div>
                          </div>
                      </div>
                      <div class="date clearfix">
                        <label for="" class="font2">交易日期：</label>
                        <input type="button" value="全部" class="all font2">
                        <input type="date" value="2017-1-10" class="time font2">
                        <i></i>
                        <input type="date" value="2017-1-10" class="time font2">
                        <input type="search" class="search">
                        <input type="button" onclick="method5('tableExcel')" value="导出excel表格" class="font2 excel" style="width: 130px;margin-left: 110px;">
                      </div>
                  </form>
              </div>
               <div class="Part-Two" id="myDiv">
                  <table id="tableExcel">
                      <thead>
                        <tr>
                          <th>产品编号</th>
                          <th>产品类型</th>
                          <th>交易类型</th>
                          <th>贴现率(%)</th>
                          <th>票据金额(万)</th>
                          <th>承兑人</th>
                          <th>票据期限(天)</th>
                          <th>票源地址</th>
                          <th>交易状态</th>
                          <th>备注</th>
                        </tr>
                      </thead>
                      <tbody>
                        <tr>
                          <td class="font3">1</td>
                          <td class="font3">银承纸票</td>
                          <td class="font3">询价买入</td>
                          <td class="font3">3.5</td>
                          <td class="font3">10000</td>
                          <td class="font3">股份制行</td>
                          <td class="font3">30</td>
                          <td class="font3">重庆</td>
                          <td class="font3">交易完成</td>
                          <td class="font3">交易完成</td>
                        </tr>
                        <tr>
                          <td class="font3">1</td>
                          <td class="font3">银承纸票</td>
                          <td class="font3">询价买入</td>
                          <td class="font3">3.5</td>
                          <td class="font3">10000</td>
                          <td class="font3">股份制行</td>
                          <td class="font3">30</td>
                          <td class="font3">重庆</td>
                          <td class="font3">交易完成</td>
                          <td class="font3">交易完成</td>
                        </tr>
                      </tbody>
                  </table>
              </div>
          </div>
      </div>
  </div>
</div>


<script language="JavaScript" type="text/javascript">
//导入excel表格
    var idTmr;
    function  getExplorer() {
        var explorer = window.navigator.userAgent ;
        //ie
        if (explorer.indexOf("MSIE") >= 0) {
            return 'ie';
        }
        //firefox
        else if (explorer.indexOf("Firefox") >= 0) {
            return 'Firefox';
        }
        //Chrome
        else if(explorer.indexOf("Chrome") >= 0){
            return 'Chrome';
        }
        //Opera
        else if(explorer.indexOf("Opera") >= 0){
            return 'Opera';
        }
        //Safari
        else if(explorer.indexOf("Safari") >= 0){
            return 'Safari';
        }
    }
    function method5(tableid) {
        if(getExplorer()=='ie')
        {
            var curTbl = document.getElementById(tableid);
            var oXL = new ActiveXObject("Excel.Application");
            var oWB = oXL.Workbooks.Add();
            var xlsheet = oWB.Worksheets(1);
            var sel = document.body.createTextRange();
            sel.moveToElementText(curTbl);
            sel.select();
            sel.execCommand("Copy");
            xlsheet.Paste();
            oXL.Visible = true;

            try {
                var fname = oXL.Application.GetSaveAsFilename("Excel.xls", "Excel Spreadsheets (*.xls), *.xls");
            } catch (e) {
                print("Nested catch caught " + e);
            } finally {
                oWB.SaveAs(fname);
                oWB.Close(savechanges = false);
                oXL.Quit();
                oXL = null;
                idTmr = window.setInterval("Cleanup();", 1);
            }

        }
        else
        {
            tableToExcel(tableid)
        }
    }
    function Cleanup() {
        window.clearInterval(idTmr);
        CollectGarbage();
    }
    var tableToExcel = (function() {
        var uri = 'data:application/vnd.ms-excel;base64,',
                template = '<html><head><meta charset="UTF-8"></head><body><table>{table}</table></body></html>',
                base64 = function(s) { return window.btoa(unescape(encodeURIComponent(s))) },
                format = function(s, c) {
                    return s.replace(/{(\w+)}/g,
                            function(m, p) { return c[p]; }) }
        return function(table, name) {
            if (!table.nodeType) table = document.getElementById(table)
            var ctx = {worksheet: name || 'Worksheet', table: table.innerHTML}
            window.location.href = uri + base64(format(template, ctx))
        }
    })()

</script>
</body>
</html>